package com.likerSai;

import com.likerSai.util.ListNode;

/**
 * 合并两个有序链表
 *
 * @author sun.ye
 * @since 2022-03-25 15:21
 */
public class MergeTwoLists {



    public static ListNode mergeTwoLists(ListNode list1, ListNode list2){

        if (list1 == null && list2 == null){
            return null;
        }
        if (list1 == null){
            return list2;
        }
        if (list2 == null){
            return list1;
        }

        ListNode list1Head = list1;
        ListNode list2Head = list2;
        while (list1Head.next != null && list2Head.next != null){
            if (list1Head.val > list2Head.val && list1Head.next.val < list2Head.val){
                list2Head
            }
        }



    }

    public static void mergeTwoNode(ListNode node1, ListNode node2){

        if (node1.next != null || node2.next != null){
            if (node1.val > node2.val){
                mergeTwoNode(node1,node2.next);
            }else {
                mergeTwoNode(node1.next,node2);
            }
        }


        if (node1.val > node2.val){
            node2.next = node1;
        }else {
            node1.next = node2;
        }
    }

}